{template 'header', 'member'}
<!--main-block start-->
<div class="main-block bd-gray mt10">
	<div class="hd fn-clear">
		<h2 class="fn-left">发布{$MOD[name]}</h2>
	</div>
	<ul id="data-nav" class="main-nav mt10 fn-clear">
		<li id="status_"><a href="{url('member/my')}?mid={$mid}&action=add">添加{$MOD[name]}</a></li>
		<li id="status_3"><a href="{url('member/my')}?mid={$mid}">已发布({$nums[3]})</a></li>
		<li id="status_2"><a href="{url('member/my')}?mid={$mid}&status=2">审核中({$nums[2]})</a></li>
		<li id="status_1"><a href="{url('member/my')}?mid={$mid}&status=1">未通过({$nums[1]})</a></li>
		<li id="status_4"><a href="{url('member/my')}?mid={$mid}&status=4">已过期({$nums[4]})</a></li>
	</ul>
	{if $action=='add' || $action=='edit'}
	<form id="pub-form" name="pub-form" method="post" action="{url('member/my')}">
		<input type="hidden" name="action" value="{$action}"/>
		<input type="hidden" name="mid" value="{$mid}"/>
		<input type="hidden" name="itemid" value="{$itemid}"/>
		<input type="hidden" name="forward" value="{$forward}"/>
		<table class="data-form">
			{if $status==1 && $action=='edit' && $note}
			<tr>
				<th width="90">未通过原因</th>
				<td width="640">{$note}</td>
			</tr>
			{/if}
			<tr>
				<th width="90"><span class="cred">*</span> 信息类型</th>
				<td width="640">
					{loop $TYPE $k $v}
					<input class="nobd fn-left mr5" id="typeid_{$k}" type="radio" name="post[typeid]" value="{$k}" {if $k==$typeid}checked{/if}/> <label class="mr10 fn-left" for="typeid_{$k}" id="t_{$k}">{$v}</label>
					{/loop}
				</td>
			</tr>
			<tr>
				<th width="90"><span class="cred">*</span> 信息标题</th>
				<td width="640"><input name="post[title]" type="text" size="50" class="graybd-ipt easyui-validatebox" data-options="required:true,validType:'length[3,50]',invalidMessage:'长度在3-50内',missingMessage:'请输入标题'"  value="{$title}"/> （2-30个字）<span id="dtitle" class="cred"></span></td>
			</tr>
			<tr>
				<th width="90"><span class="cred">*</span> 所属分类</th>
				<td width="640">{Post::catTree('post[catid]', $moduleid, '选择分类' ,$catid, 'class="easyui-validatebox" data-options="required:true,missingMessage:\'请选择分类\'"')} <span id="dcatid" class="cred"></span></td>
			</tr>
			<tr id="carcatTr">
				<th width="90">适用车型</th>
				<td width="640">
					{Post::autoCombo('post[arbid][]','post[arcid][]', 'post[amid][]', $item['arbid'],$item['arcid'],$item['amid'], 0, 0, 0)}
				</td>
			</tr>
			<tr>
				<th >采购信息</th>
				<td >
					<p><label for="buy-num">采购数量</label>
			            <input id="buy-num" name="post[amount]" type="text" size="20" value="{$amount}" class="graybd-ipt"/></p>
					<p class="mt10"><label for="price">采购价格</label>
					   <input id="price" name="post[price]" type="text" size="20" value="{$price}" class="graybd-ipt"/></p>
					<p class="mt10"><label for="intro">{$MOD['name']}说明</label>
					   <textarea id="intro" name="post[introduce]" style="width:90%;height:45px;" class="graybd-ipt">{$introduce}</textarea></p>
					<p class="mt10 c666">建议详细填写交易条件，以便符合要求的卖家与您取得联系</p>
				</td>
			</tr>
			<tr>
				<th width="90">详细说明</th>
				<td width="640">
					{Post::kindEditor('post[content]', $moduleid, $content,'','675px','280px')}
				</td>
			</tr>
			<tr>
				<th width="90">采购图片</th>
				<td width="640">{Post::picture($moduleid, 'thumb', 'post[thumb]', $thumb ,$MOD['thumb_width'], $MOD['thumb_height'])}</td>
			</tr>
			{if $IMVIP || !$MG[uploadpt]}
			<tr>
				<th width="90">采购图片</th>
				<td width="640">{Post::picture($moduleid, 'thumb1', 'post[thumb1]', $thumb1 ,$MOD['thumb1_width'], $MOD['thumb1_height'])}</td>
			</tr>
			<tr>
				<th width="90">采购图片</th>
				<td width="640">{Post::picture($moduleid, 'thumb2', 'post[thumb2]', $thumb2 ,$MOD['thumb2_width'], $MOD['thumb2_height'])}</td>
			</tr>
			{/if}
			<tr>
				<th >过期时间</th>
				<td class="tr">{Post::calender('post[totime]', $totime, 'width:100', true)}</td>
			</tr>
			<tr>
				<th width="90"><span class="cred">*</span>发布单位 </th>
				<td width="640"><input name="post[company]" type="text" {if $_groupid>5}class="easyui-validatebox graybd-ipt" data-options="required:true,validType:'length[3,50]',missingMessage:'请填写发布单位'" {/if}size="50"  value="{if $company}{$company}{else}{$userinfo[company]}{/if}"/> </td>
			</tr>
			<tr>
				<th width="90"><span class="cred">*</span> 联系人</th>
				<td width="640"><input name="post[truename]" type="text" id="truename" class="graybd-ipt easyui-validatebox" data-options="required:true,validType:'length[1,50]',missingMessage:'请填写联系人'"  size="20" datatype="*2-999" nullmsg="请填写联系人" errormsg="最少输入2个字符"  value="{if $truename}{$truename}{else}{$userinfo[truename]}{/if}" /> <br/>
			</tr>
			<tr>
				<th width="90">{if $MG['memtype'] >= 5}<span class="cred">*</span>{/if} 联系电话</th>
				<td width="640"><input name="post[telephone]" type="text" size="30" {if $MG['memtype'] >= 5}class="graybd-ipt easyui-validatebox" data-options="required:true,validType:'length[3,50]',missingMessage:'请填写联系电话'"{/if}  value="{if $telephone}{$telephone}{else}{$userinfo[telephone]}{/if}" /></td>
			</tr>
			<tr>
				<th width="90"><span class="cred">*</span> 联系手机</th>
				<td width="640"><input name="post[mobile]" type="text" size="30" class="graybd-ipt easyui-validatebox" data-options="required:true,validType:'length[3,50]',missingMessage:'请填写联系手机'" value="{if $mobile}{$mobile}{else}{$userinfo[mobile]}{/if}" /></td>
			</tr>
			<tr>
				<th width="90">联系地址</th>
				<td width="640"><input name="post[address]" type="text" size="60" class="easyui-validatebox graybd-ipt" value="{if $address}{$address}{else}{$userinfo[address]}{/if}"/></td>
			</tr>
			<tr>
				<th>发布地区</th>
				<td class="tr">
					{if $action == 'add'}
					{Post::areaCombo('post[areaid]', $userInfo[areaid], '', '', $moduleid )}
					{elseif $action =='edit'}
					{Post::areaCombo('post[areaid]', $areaid, '', '', $moduleid )}
					{/if}
				</td>
			</tr>
			{if !$_userid}
			{template 'guest_contact', 'chip'}
			{/if}
			{if $need_captcha}
			<tr>
				<th ><span class="cred">*</span> 验证码</th>
				<td class="tr">{template 'captcha', 'chip'} <span id="dcaptcha" class="cred"></span></td>
			</tr>
			{/if}
			<tr>
				<th>&nbsp;</th>
				<td class="sub-info">
					<button type="submit" class="btn">提 交</button>
					<input type="button" value=" 返 回 " class="btn" onclick="history.back(-1);"/>
				</td>
			</tr>
		</table>
	</form>
	<script type="text/javascript">
		seajs.use(['$'], function ($) {
			$("#pub-form").form();
		});
	</script>
	{else}
	<div class="filter con fn-clear">
		<form id="buy-filter-form" name="buy-filter-form" action="{url('member/my')}" method="post">
			<input type="hidden" name="mid" value="{$mid}"/>
			<input type="hidden" name="status" value="{$status}"/>
			{Post::catTree('catid', $moduleid, '不限分类', $catid, 'class="fn-left mr10"')}
			<input class="fn-left mr10" type="text" name="kw" value="{$kw}" title="关键词" size="60"/>
			<button class="btn fn-left mr20" type="submit">搜索</button>
			<button class="btn fn-left" type="reset" onclick="window.location='{url('member/my')}?mid={$mid}&status={$status}';">重置</button>
		</form>
	</div>
	<form method="post" action="{url('member/my')}">
		<table class="filter-tb mt10 c000 con">
			<thead>
			<tr class="c666">
				<th width="300"><input id="sel-all" class="nobd mr10 fn-left" type="checkbox"><label class="fn-left" for="sel-all">标 题</label></th>
				<th width="100">分 类</th>
				<th width="120">{if $timetype=='add'}添加{else}更新{/if}时间</th>
				<th width="60">浏览</th>
				<th width="120">管理</th>
			</tr>
			</thead>
			<tbody id="pub-list">
			{loop $lists $k $v}
			<tr>
				<td>
					<input type="checkbox" name="itemid[]"  class="nobd mr10 fn-left" value="{$v[itemid]}"/>
                    {if $v[status]==3}
                    <a class="fn-left" href="{url($module.'/show', 'itemid='.$v['itemid'])}" target="_blank">{$v[title]}</a>
                    {else}
                    <a class="fn-left" href="{url('member/my')}?mid={$mid}&action=edit&itemid={$v[itemid]}">{$v[title]}</a>
                    {/if}
				</td>
				<td>&nbsp;&nbsp;<a href="{url($module.'/list', 'catid='.$v['catid'])}" target="_blank">{$v[catname]}</a>&nbsp;&nbsp;</td>
				{if $timetype=='add'}
				<td class="c666" title="更新时间 {$v[editdate]}">{$v[adddate]}</td>
				{else}
				<td class="c666" title="添加时间 {$v[adddate]}">{$v[editdate]}</td>
				{/if}
				<td class="c666">{$v[hits]}</td>
				<td class="pub-oper">
					<a class="edit-link" href="{url('member/my')}?mid={$mid}&action=edit&itemid={$v[itemid]}" title="编辑">编辑</a>
					{if $MG[copy]}
					<a class="copy" href="{url('member/my')}?mid={$mid}&action=add&itemid={$v[itemid]}&catid={$v[catid]}" title="复制">复制</a>
					{/if}
					{if $MG[delete]}
					<a class="del" href="{url('member/my')}?mid={$mid}&action=delete&itemid={$v[itemid]}" onclick="return confirm('确定要删除吗？此操作将不可撤销');" title="删除">删除</a>
					{/if}
				</td>
			</tr>
			{/loop}
			</tbody>
		</table>
		{if $MG[delete] || $timetype!='add'}
		<div class=" con fn-clear">
			{if $MG[delete]}
			<button onclick="if( confirm('确定要删除选中{$MOD[name]}吗？')){this.form.action='?mid={$mid}&status={$status}&action=delete'}else{return false;}" class="btn fn-right">删除选中</button>
			{/if}
		</div>
		{/if}
	</form>
	{if $MG[purchase_limit] || (!$MG['fee_mode'] && $MOD[fee_add])}
	<div class="con">
		{if $MG[purchase_limit]}
		总共可发 <span class="f_b cred">{$MG[purchase_limit]}</span> 条&nbsp;&nbsp;&nbsp;
		当前已发 <span class="f_b">{$limit_used}</span> 条&nbsp;&nbsp;&nbsp;
		还可以发 <span class="f_b f_blue">{$limit_free}</span> 条&nbsp;&nbsp;&nbsp;
		{/if}
	</div>
	{/if}
	<div class="pages con fn-clear">
		<span class="sum fn-right">共{php echo $do->getPn()->getPages()}页</span>
		<ul class="fn-right fn-clear">
			{php $do->getPn()->render()}
		</ul>
	</div>
	{/if}
</div>
<script type="text/javascript">
	seajs.use(['member'], function(member){
		member.active('menu_info', 'mid_{$moduleid}', 'status_{$status}')
	})
</script>
{template 'footer', 'member'}
